#coding:utf-8
from django.shortcuts import render
from django.http import HttpResponse
import json

# Create your views here.
def index(request):
    #import pdb; pdb.set_trace()
    if(request.is_ajax()):
        return HttpResponse(str(int(request.GET['a']) + int(request.GET['b'])))
    else:
        list = ['我的剑就是你的剑', '你见过我的小熊吗']
        return render(request, 'index.html', {'form': AddForm(),'List': list,'JList': json.dumps(list)})

from django import forms
class AddForm(forms.Form):
    a = forms.IntegerField()
    b = forms.IntegerField()